package valueObject;

import entity.Course;
import entity.Node;
import entity.Professor;
import java.util.ArrayList;
import java.util.Collection;

/**
 *
 * @author Juan Hernández Serrato
 */
public class CourseVO implements ValueObject<Course> {
    private Integer id;
    private String name;
    private String description;
    private byte[] image;
    private Collection<ProfessorVO> professors;
    private CategoryVO category;
    private Collection<NodeVO> nodes;
    
    @Override
    public Course toEntity() {
        Course course = new Course();
        course.setCategoryidCategory(category.toEntity());
        course.setName(name);
        course.setDescription(description);
        course.setIdCourse(id);
        course.setImage(image);
        ArrayList<Node> nodesE = new ArrayList<Node>();
        if(nodes != null){
            for(NodeVO n : nodes){
                nodesE.add(n.toEntity());
            }
        }
        course.setNodeCollection(nodesE);
        ArrayList<Professor> professorsE = new ArrayList<Professor>();
        if(professors != null){
            for(ProfessorVO p : professors){
                professorsE.add(p.toEntity());
            }
        }
        course.setProfessorCollection(professorsE);
        return course;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer idCourse) {
        this.id = idCourse;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public byte[] getImage() {
        return image;
    }

    public void setImage(byte[] image) {
        this.image = image;
    }

    public Collection<ProfessorVO> getProfessors() {
        return professors;
    }

    public void setProfessors(Collection<ProfessorVO> professorCollection) {
        this.professors = professorCollection;
    }

    public CategoryVO getCategory() {
        return category;
    }

    public void setCategory(CategoryVO categoryidCategory) {
        this.category = categoryidCategory;
    }

    public Collection<NodeVO> getNodes() {
        return nodes;
    }

    public void setNodes(Collection<NodeVO> nodeCollection) {
        this.nodes = nodeCollection;
    }

}
